Northwoods.GoWPF 2.2.4 Assembly
MakeXElement Method (GraphLinksModelLinkData<NodeKey,PortKey>)

the name of the new XElement
Constructs a Linq for XML XElement holding the data of this link.
Syntax
Public Overridable Function MakeXElement( _
   ByVal n As XName _
) As XElement
public virtual XElement MakeXElement( 
   XName n
)

Parameters

n
the name of the new XElement

Return Value

an initialized XElement
Remarks

This constructs a new XElement and adds an XAttribute for each simple property that has a value different from its default value. For each property that is a collection, it adds an XElement with nested item elements. This does not add an element if the collection is empty.

Because the NodeKey type might be a type for which we have an implementation to convert to and from strings for XML, this calls the ConvertNodeKeyToString method, which you can override.

This is implemented as: public virtual XElement MakeXElement(XName n) { XElement e = new XElement(n); e.Add(XHelper.Attribute<NodeKey>("From", this.From, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute<NodeKey>("To", this.To, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute<PortKey>("FromPort", this.FromPort, default(PortKey), ConvertPortKeyToString)); e.Add(XHelper.Attribute<PortKey>("ToPort", this.ToPort, default(PortKey), ConvertPortKeyToString)); e.Add(XHelper.Attribute<NodeKey>("LabelNode", this.LabelNode, default(NodeKey), ConvertNodeKeyToString)); e.Add(XHelper.Attribute("Category", this.Category, "")); e.Add(XHelper.Attribute("Text", this.Text, "")); e.Add(XHelper.Attribute("Points", this.Points, null)); return e; }

If you add properties to this link data class, and if you are using the GraphLinksModel<NodeType,NodeKey,PortKey,LinkType>.Save<NodeDataType,LinkDataType> and GraphLinksModel<NodeType,NodeKey,PortKey,LinkType>.Load<NodeDataType,LinkDataType> methods, you should override this method to add new attributes and/or elements as needed, and you should override LoadFromXElement.

Requirements
See Also

Reference

GraphLinksModelLinkData<NodeKey,PortKey> Class
GraphLinksModelLinkData<NodeKey,PortKey> Members

 

 


© Northwoods Software 2017. All Rights Reserved.

Send Feedback